package io.gitee.hchaojie.day07;

import org.junit.Test;

import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.Paths;

public class TestPathMatcher {
    @Test
    public void test() {
//        PathMatcher matcher = new PathMatcher() {
//            @Override
//            public boolean matches(Path path) {
//                return false;
//            }
//        }

        // glob
        // 匹配器，匹配所有的txt文件
        PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:*java*.docx");

        System.out.println(matcher.matches(Paths.get("ab.txt")));
        System.out.println(matcher.matches(Paths.get("abc.txt")));
        System.out.println(matcher.matches(Paths.get("babc.txt")));
    }
}
